/*
 *  BgSubtraction4.h
 *  opencvTest
 *
 *  Created by a1gucis on 3/1/09.
 *  Copyright 2009 __MyCompanyName__. All rights reserved.
 *
 */
#ifndef BG_SUBTRACTION4_H
#define BG_SUBTRACTION4_H
#include <iostream>
#include <vector.h>
#include "systeminclude.h"
#include "codebook.h"

using namespace std;
class CodeBookModel {
private:
	unsigned *cbBounds, channels;
	int *minMod, *maxMod;
	vector<CodeBook> *codeBooks;
	CodeBook cb;
	int update_codebook(uchar *p, CodeBook &c, unsigned *cbBounds, int numChannels); 
	int clear_stale_entries(CodeBook &c);
	uchar background_diff(uchar *p, CodeBook &c, int numChannels, int* minMod, int* maxMod);  	
	
public:
	CodeBookModel(int, int);
	~CodeBookModel();
	void setCbBounds(int, int, int);
	void updateBG(IplImage *);
	void clearStale();
	void bgDiff(IplImage *, IplImage *);
};

#endif